<%@page import="sdfi.lee.DAO.RolltypeDAO"%>
<%@page import="sdfi.lee.Entity.Rollnotice"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core"%>
    <%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<c:url value='/css/common.css' />" >
<script type="text/javascript" src="<c:url value='/js/jquery-1.6.js' />"></script>
<script type="text/javascript">
	$(function(){
		$("a[id]").click(function(){
			var url="../DeleteRollnotice";
			var a=$(this);
		
			$.ajax({
				url:url,
				data:{id:a.attr("id")},
				dataType:"text",
				error:function(xhr,status)
				{
					alert("系统出错了");
				},
				success:function(data,status)
				{
				
					if(data=="success")
						{
						
						a.parents("div.newlist").remove();
						}
				}
			});
			return false;
		});
		
	});
</script>
<title>Insert title here</title>
</head>
<body>
<%
	String pg=request.getParameter("pg");
	if(pg==null||pg.equals(""))
	{
		pg="1";
	}
	String rtype=request.getParameter("rolltype");
	if(rtype==null||rtype.equals(""))	rtype="1";
	List<Rollnotice> list=new RolltypeDAO().getRollnotice(Integer.valueOf(pg).intValue(),15,rtype);
		request.setAttribute("listnotice",list);
	%>
<div class="hehe">
	<c:forEach items="${requestScope.listnotice}" var="notice">
	
		<div class="newlist">
			<div class="newlist_title" title="${notice.rolltitle}"><a>${fn:substring(notice.rolltitle,0,35)}</a></div>
			<div class="newlist_date">${notice.rolldate} &nbsp;&nbsp;<a style="cursor:pointer" id="${notice.id}">删除</a></div>
		</div>
	</c:forEach>
</div>
<div id="pages">
		<c:if test="${param.pg!=null}">
		<c:url value="/admin/druglist.jsp?rolltype=${param.rolltype}&pg=${param.pg-1}" var="up"></c:url>
		</c:if>
			<c:url value="/admin/druglist.jsp?rolltype=${param.rolltype}&pg=${param.pg+1}" var="down"></c:url>
		<font>
			
				<c:if test="${param.pg==null||param.pg==1}">&lt;</c:if>
				<c:if test="${param.pg!=null&&param.pg!=1 }"><a href="${up}">&lt;</a></c:if>
			
		</font>
		<font>
			<c:choose>
			<c:when test="${param.pg==null||param.pg==1}">1</c:when>
			<c:otherwise>${param.pg}</c:otherwise>
		</c:choose>
		</font>
		<font>
			<c:choose>
				<c:when test="${fn:length(listnotice)<15}">&gt;</c:when>
				<c:otherwise><a href="${down}">&gt;</a></c:otherwise>
			</c:choose>
		</font>
	</div>
</body>
</html>